const pubUrl = "..."

const http = (options) => {
  return new Promise((resolve, reject) => {
    let header = {
      contentType: 'application/json; charset=utf-8; multipart/form-data',
    }

    // header['token'] = wx.getStorageSync('token'); // token 的获取
    
    wx.request({
      url: pubUrl + options.url,
      method: options.method || 'get',
      data: options.data || {},
      header: options.header || header,
      success: (res) => {
        resolve(res);
      },
      fail: (err) => {
          reject(err);
      }
    })
  })
}

export default http